<template>
	<el-dialog title="资产明显"  class="my-dialog-class" width="70%" height="300" :visible.sync="dialogVisible"
		:before-close="handleClose"  :append-to-body="appendToBody">
		<div class="gk-layout-container">
			<div class="gk-layout-main" style="height:450px">
				<el-table :data="dataList" :key="componentKey" class='gk-main-table' :loading="loading"
					size="mini" align="left" style="width:100%; overflow:auto;">
					<el-table-column :label="$t('action.desc')" width="50" fixed="left" header-align="center"
						align="center">
						<template slot-scope="scope"> {{ scope.$index + 1 }} </template>
					</el-table-column>
					<Column prop="itemId" label="物料名称" width=500 :formatter="itemFilter" />

					<Column label="数量" prop="countDb" :formatter="countFormat" />
					<column prop="boxCode" label="托盘码" />
				    <column prop="rLocId" label="位置" />
					<Column prop="status" label="状态" :formatter="selectionFormat" /> 
				    <Column prop="outTime" label="出库时间" :formatter="dateFormatDay" /> 
				</el-table>
			</div>
		</div>
	</el-dialog>
</template>
<script>
import KtButton from "@/views/Core/KtButton"
import { format, formatDay } from "@/utils/datetime"
import Column from "@/views/Core/Column"
import MyTable from "@/views/Core/MyTable"
import { dictsFormat, getItemName } from "@/utils/myUtil"
import SDictForm from "@/components/Kj/SDictForm"
export default {
	name: 'CoreStockView',
	components: {
		KtButton,
		Column,
		MyTable,
		SDictForm
	},
	props: {
		appendToBody: {
			type: Boolean,
			default: true,
		},
	 
		dialogVisible: false,
		dataList:Array
	},
	data() {
		return {
			size: 'small',
			componentKey: 0,
			loading: false,
		 

		}
	},
	methods: {
		 
		dateFormatDay: function (row, column, cellValue, index) {
			return format(row[column.property])
		},
		countFormat: function (row, column, cellValue, index) {
			return cellValue + dictsFormat("units", row.unit)
		},
		itemFilter: function (row, column, cellValue, index) {
			return getItemName(cellValue)
		},
		selectionFormat: function (row, column, cellValue, index) {
			let key = ""
			let propt = column.property;
			if (propt == "status") {
				key = "stockStatus"
			}
			else if (propt == "storeStatus") {
				key = "storeStatus"
			} else if (propt == "locked") {
				key = "isLocked"
			} else if (propt == "wh") {
				key = "wh"
			}
			return dictsFormat(key, cellValue)
		},
		handleClose: function () {
			this.$emit('csdsHidden', {})
		},
	},
	mounted() {
	}
}
</script>

<style scoped></style>